<template>
  <div>
    <div class="container1">
      <div class="common-title-flex">
        <div class="common-title-div"></div>
        <div class="common-title-text">劳务公司查询条件</div>
      </div>
      <el-form ref="searchObj" :inline="true" :model="searchObj" size="mini" label-width="120px" style="margin-bottom:-10px;margin-top:10px;">
        <el-form-item label="劳务公司名称">
          <el-input v-model="searchObj.labourName" placeholder="请输入劳务公司名称" clearable></el-input>
        </el-form-item>
        <!-- <el-form-item label="公司编号">
                        <el-input v-model="searchObj.companyCode" placeholder="请输入公司编号" clearable ></el-input>
                    </el-form-item> -->
        <el-form-item style="margin-left:2rem;">
          <el-button type="primary" icon="el-icon-search" @click="query">查询</el-button>
          <el-button @click="reset" icon="el-icon-refresh">重置</el-button>
        </el-form-item>
      </el-form>
    </div>
    <div class="container" style="margin-top:1rem;">
      <div class="common-list-class">
        <div style="display:flex;">
          <div class="common-title-div"></div>
          <div class="common-title-text">劳务公司查询列表</div>
        </div>
        <div style="display:flex;">
          <!-- <el-upload
                    v-if="typeCode == 'police'"
                    class="upload-file"
                    :headers="uploadHeader"
                    :before-upload="beforeUpload"
                    :action="uploadUrl"
                    :on-success="uploadSucess"
                    :on-error="uploadError"
                    :show-file-list="false">
                        <el-button type="primary" icon="el-icon-download">批量导入</el-button>
                    </el-upload>
                    <el-button type="primary" v-if="typeCode == 'police'" style="height:32px;margin-left:10px;" icon="el-icon-upload">模版下载</el-button> -->
          <!-- <el-button type="primary" style="height:32px;" icon="el-icon-upload2">批量导出</el-button> -->
          <el-button type="primary" style="height:32px;" v-if="typeCode == 'police'" icon="el-icon-circle-plus-outline" @click="addCompany">添加</el-button>
          <el-button type="primary" style="height:32px;" v-if="typeCode == 'business'" icon="el-icon-circle-plus-outline" @click="bindCompany">绑定</el-button>
          <!-- <el-button type="primary" style="height:32px;" icon="el-icon-circle-plus-outline" @click="bindCompany">绑定</el-button> -->
        </div>
      </div>
      <!-- 查询列表 -->
      <el-table :data="tableData" size="mini" :row-style="rowStyle" :header-cell-style="tableHeaderColor" @sort-change="sortChange" @cell-click="cellChange" style="width: 100%;margin-top:10px;margin-bottom:10px;" max-height="550" border>
        <el-table-column prop="labourName" width="150" label="劳务公司名称" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="officeAddr" label="办公地址" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="employeeNum" width="120" label="在职人数" sortable show-overflow-tooltip align="center">
          <template slot-scope="scope">
            <div style="cursor: pointer;">
              {{scope.row.employeeNum}}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="legalPerson" v-if="typeCode == 'police'" label="法人" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="registAddr" v-if="typeCode == 'police'" label="注册地址" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="officeAddr" label="办公地址" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="componentNum" v-if="typeCode == 'police'" width="120" label="服务企业数量" show-overflow-tooltip align="center">
          <template slot-scope="scope">
            <div style="cursor: pointer;">
              {{scope.row.componentNum}}
            </div>
          </template>
        </el-table-column>
        <el-table-column prop="labourSiteName" label="驻厂代表" v-if="typeCode == 'business'" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="labourSitePhone" label="驻厂手机号" v-if="typeCode == 'business'" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column prop="statusDesc" v-if="typeCode == 'police'" label="状态" show-overflow-tooltip align="center">
        </el-table-column>
        <el-table-column fixed="right" label="操作" align="center" :width="typeCode == 'police'?'350':'150'">
          <template slot-scope="scope">
            <el-button type="primary" size="mini" icon="el-icon-edit" v-if="typeCode == 'police'" @click.stop="editClick(scope.row)">修改</el-button>
            <el-button type="primary" size="mini" icon="el-icon-tickets" @click.stop="detailsClick(scope.row)">详情</el-button>
            <el-button type="success" size="mini" icon="el-icon-video-play" v-if="typeCode == 'police' && scope.row.status == '0'" @click.stop="startClick(scope.row)">启用</el-button>
            <el-button type="danger" size="mini" icon="el-icon-remove" v-if="typeCode == 'police' && scope.row.status == '1'" @click.stop="forbidClick(scope.row)">停用</el-button>
            <el-button type="danger" size="mini" icon="el-icon-delete" v-if="typeCode == 'police'" @click.stop="deleteClick1(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!-- 分页 -->
      <el-row type="flex" justify="end">
        <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="pageSizes" :page-size="pagesize" layout="total, sizes, prev, pager, next, jumper" :total="total">
        </el-pagination>
      </el-row>
    </div>
    <!-- 新增警员 和修改警员-->
    <el-dialog :title="isEditTitle" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="newaddFlag" width="60%" :before-close="handleClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">{{isEditTitle}}</div>
      </div>
      <el-form :inline="true" ref="inputObj" :model="inputObj" label-width="140px" :rules="rules">
        <el-form-item label="劳务公司名称" prop="labourName">
          <el-input v-model="inputObj.labourName" placeholder="请输入劳务公司名称" clearable style="width: 100%;"></el-input>
        </el-form-item>
        <el-form-item label="统一社会信用编码" prop="componentCode">
          <el-input v-model="inputObj.componentCode" placeholder="请输入统一社会信用编码" clearable style="width:100%"></el-input>
        </el-form-item>
        <el-form-item label="注册资本" prop="registFunds">
          <el-input v-model="inputObj.registFunds" placeholder="请输入注册资本" clearable></el-input>
        </el-form-item>
        <el-form-item label="注册地址" prop="registAddr">
          <el-input v-model="inputObj.registAddr" placeholder="请输入注册地址" clearable></el-input>
        </el-form-item>
        <el-form-item label="人员规模" prop="peopleNumber">
          <el-input v-model="inputObj.peopleNumber" placeholder="请输入人员规模" clearable></el-input>
        </el-form-item>
        <el-form-item label="成立日期" prop="registTime">
          <el-date-picker class="setTime_class" v-model="inputObj.registTime" value-format="yyyyMMdd" type="date" placeholder="选择成立日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="法人姓名" prop="legalPerson">
          <el-input v-model="inputObj.legalPerson" placeholder="请输入法人姓名" clearable></el-input>
        </el-form-item>
        <el-form-item label="法人身份证号" prop="legalIdentity">
          <el-input v-model="inputObj.legalIdentity" placeholder="请输入法人身份证号" clearable></el-input>
        </el-form-item>
        <el-form-item label="办公地址" prop="officeAddr">
          <el-input v-model="inputObj.officeAddr" placeholder="请输入办公地址" clearable></el-input>
        </el-form-item>
        <el-form-item label="办公电话" prop="officePhone">
          <el-input v-model="inputObj.officePhone" placeholder="请输入办公电话" clearable></el-input>
        </el-form-item>
        <el-form-item label="负责人姓名" prop="managerName">
          <el-input v-model="inputObj.managerName" placeholder="请输入负责人姓名" clearable></el-input>
        </el-form-item>
        <el-form-item label="负责人电话" prop="managerPhone">
          <el-input v-model="inputObj.managerPhone" placeholder="请输入负责人电话" clearable></el-input>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" size="mini" @click="submit">提 交</el-button>
        <el-button size="mini" @click="cancel">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 警员详情 -->
    <el-dialog title="劳务公司详情" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="detailsFlag" width="60%" :before-close="detailsClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">劳务公司详情</div>
      </div>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">劳务公司名称</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.labourName}}</el-col>
        <el-col :span="6" class="bold-class">统一社会信用编码</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.componentCode}}</el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">注册资本</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.registFunds}}</el-col>
        <el-col :span="6" class="bold-class">注册地址</el-col>
        <el-col :span="12" class="grey-class" :title="detailsObj.registAddr" style="text-overflow: ellipsis;overflow: hidden;white-space: nowrap;">{{detailsObj.registAddr}}</el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">人员规模</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.peopleNumber}}</el-col>
        <el-col :span="6" class="bold-class">成立日期</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.registTime}}</el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">法人姓名</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.legalPerson}}</el-col>
        <el-col :span="6" class="bold-class">法人身份证号</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.legalIdentity}}</el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">办公地址</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.officeAddr}}</el-col>
        <el-col :span="6" class="bold-class">办公电话</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.officePhone}}</el-col>
      </el-row>
      <el-row type="flex" justify="center">
        <el-col :span="6" class="bold-class">负责人姓名</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.managerName}}</el-col>
        <el-col :span="6" class="bold-class">负责人电话</el-col>
        <el-col :span="12" class="grey-class">{{detailsObj.managerPhone}}</el-col>
      </el-row>
      <span slot="footer" class="dialog-footer">
        <el-button @click="detailsClose">关 闭</el-button>
      </span>
    </el-dialog>

    <!-- 绑定劳务公司 -->
    <el-dialog title="绑定劳务公司" :close-on-click-modal="false" :close-on-press-escape="false" :visible.sync="bindingFlag" width="45%" :before-close="bindingClose" center>
      <div slot="title" class="header-title">
        <div class="header-title-div"></div>
        <div class="header-title-text">绑定劳务公司</div>
      </div>
      <div>
        <el-transfer filterable :titles="['未绑定劳务公司', '已绑定劳务公司']" filter-placeholder="请输入劳务公司名称" v-model="selectCompany" :data="bindingList">
        </el-transfer>
      </div>

      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="bindingConfirm">确 定</el-button>
        <el-button @click="bindingClose">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import mixin from "@/mixin/mixin.js";
export default {
  name: "companyManage",
  mixins: [mixin],
  data() {
    return {
      bindingList: [],
      selectCompany: [1, 4],
      bindingFlag: false,
      uploadHeader: {},
      uploadUrl: "https://jsonplaceholder.typicode.com/posts/",
      rules: {
        labourName: [
          { required: true, message: "请输入公司名称", trigger: "blur" },
        ],
        legalPerson: [
          { required: true, message: "请输入法人姓名", trigger: "blur" },
          {
            validator: (rule, value, callback) => {
              if (value && value.length) {
                if (!/^[\u4e00-\u9fa5a-zA-Z]+$/.test(value.trim())) {
                  callback(new Error("法人姓名格式错误！"));
                } else {
                  callback();
                }
              } else {
                callback();
              }
            },
            trigger: "blur",
          },
        ],
        legalIdentity: [
          { required: false, message: "请输入法人身份证号", trigger: "blur" },
          {
            validator: (rule, value, callback) => {
              if (value && value.length) {
                if (
                  !/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(
                    value.trim()
                  )
                ) {
                  callback(new Error("身份证格式错误！"));
                } else {
                  callback();
                }
              } else {
                callback();
              }
            },
            trigger: "blur",
          },
        ],
        registAddr: [
          { required: true, message: "请输入注册地址", trigger: "blur" },
        ],
        officeAddr: [
          { required: true, message: "请输入办公地址", trigger: "blur" },
        ],
        managerName: [
          { required: true, message: "请输入负责人姓名", trigger: "blur" },
        ],
        managerPhone: [
          { required: true, message: "请输入负责人电话", trigger: "blur" },
          {
            validator: (rule, value, callback) => {
              // 手机正则校验
              if (value && value.length) {
                if (!/^1[3456789]\d{9}$/.test(value.trim())) {
                  callback(new Error("手机号码错误！"));
                } else {
                  callback();
                }
              } else {
                callback();
              }
            },
            trigger: "blur",
          },
        ],
        officePhone: [
          { required: false, message: "请输入办公电话", trigger: "blur" },
          {
            validator: (rule, value, callback) => {
              // 手机正则校验
              if (value && value.length) {
                if (!/^1[3456789]\d{9}$/.test(value.trim())) {
                  callback(new Error("手机号码错误！"));
                } else {
                  callback();
                }
              } else {
                callback();
              }
            },
            trigger: "blur",
          },
        ],
      },
      detailsObj: {},
      inputObj: {},
      detailsFlag: false,
      isEditTitle: "",
      newaddFlag: false,
      pageSizes: [10, 15, 50, 100],
      pagesize: 10,
      total: 10,
      currentPage: 1,
      tableData: [],
      searchObj: {
        labourName: "",
        peopleNumberStatus: 0,
      },
      currentId: "",
    };
  },
  created() {
    this.query();
  },
  methods: {
    bindCompany() {
      let self = this;
      self.showLoading();
      self
        .$axios({
          method: "get",
          url: `/labour/queryBindInitInfo`,
          headers: {
            Authorization: self.requestToken,
          },
        })
        .then((res) => {
          self.hideLoading();
          if (res.data.code == "20000") {
            self.bindingFlag = true;
            let labours = res.data.data.labours;
            let labourList = res.data.data.labourList;
            let dataList = [];
            labours.forEach((item) => {
              dataList.push({
                key: item.id,
                label: item.labourName,
              });
            });
            self.bindingList = dataList;
            self.selectCompany = labourList.map((value) => value["id"]);
            console.log("self.bindingList", self.bindingList);
            console.log("self.selectCompany", self.selectCompany);
          } else {
            self.$message.error(res.data.message);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
    bindingConfirm() {
      let self = this;
      self.showLoading();
      let params = {
        labourIds: self.selectCompany,
      };
      self
        .$axios({
          method: "post",
          url: `/labour/bindLaboursInfo`,
          headers: {
            Authorization: self.requestToken,
          },
          data: params,
        })
        .then((res) => {
          self.hideLoading();
          if (res.data.code == "20000") {
            self.bindingFlag = false;
            self.$message.success("绑定成功！");
            self.query();
          } else {
            self.$message.error(res.data.message);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
    bindingClose() {
      this.bindingFlag = false;
    },
    cellChange(row, column, cell, event) {
      let labourName = row.labourName;
      if (column.label == "在职人数") {
        this.$router.push({
          name: "allPerson",
          params: { labourName: row.labourName, status: "在职人员" },
        });
      } else if (column.label == "服务企业数量") {
        this.$router.push({
          name: "businessManage",
          params: { labourName: row.labourName },
        });
      }
    },
    sortChange({ column, prop, order }) {
      if (column.label == "在职人数") {
        if (order == "ascending") {
          console.log("正序");
          this.searchObj.peopleNumberStatus = 0;
          this.query();
        } else if (order == "descending") {
          this.searchObj.peopleNumberStatus = 1;
          this.query();
          console.log("倒序");
        }
      }
    },
    tableHeaderColor({ row, column, rowIndex, columnIndex }) {
      return "background-color:#f5f5f5;color:#626262;";
    },
    rowStyle({ row, rowIndex }) {
      let style1 = {};
      let style2 = {};
      if (rowIndex % 2 == 0) {
        style1.background = "#ffffff";
        return style1;
      } else {
        style2.background = "#f5f5f5";
        return style2;
      }
    },
    beforeUpload(file) {
      this.showLoading("导入中");
    },
    uploadSucess(response) {
      this.$message({
        message: "导入成功！",
        type: "success",
      });
      this.hideLoading();
      console.log("response------", response);
    },
    uploadError(error) {
      this.$message({
        message: "导入失败！",
        type: "error",
      });
      this.hideLoading();
      console.log("error-----", error);
    },
    // 新建确认和修改确认
    submit() {
      let self = this;
      this.$refs["inputObj"].validate((valid) => {
        if (valid) {
          if (self.isEditTitle == "新增劳务公司") {
            let params = self.inputObj;
            self.showLoading();
            self
              .$axios({
                method: "post",
                url: `/labour/addLaborManager`,
                headers: {
                  Authorization: self.requestToken,
                },
                data: params,
              })
              .then((res) => {
                self.hideLoading();
                if (res.data.code == "20000") {
                  self.$message.success("新增成功！");
                  self.newaddFlag = false;
                  self.inputObj = {};
                  self.$refs["inputObj"].resetFields();
                  self.query();
                } else {
                  self.$message.error(res.data.message);
                }
              })
              .catch((err) => {
                self.hideLoading();
                self.$message.error(err);
              });
          } else {
            let params = self.inputObj;
            params.id = self.currentId;
            self.showLoading();
            self
              .$axios({
                method: "post",
                url: `/labour/editLaborManager`,
                headers: {
                  Authorization: self.requestToken,
                },
                data: params,
              })
              .then((res) => {
                self.hideLoading();
                if (res.data.code == "20000") {
                  self.$message.success("修改成功！");
                  self.newaddFlag = false;
                  self.inputObj = {};
                  self.$refs["inputObj"].resetFields();
                  self.query();
                } else {
                  self.$message.error(res.data.message);
                }
              })
              .catch((err) => {
                self.hideLoading();
                self.$message.error(err);
              });
          }
        } else {
          return false;
        }
      });
    },
    // 取消点击
    cancel() {
      this.newaddFlag = false;
      this.inputObj = {};
      this.$refs["inputObj"].resetFields();
    },
    // 取消点击
    handleClose() {
      this.cancel();
    },
    // 点击分页当前页多少数据
    handleSizeChange(val) {
      this.pagesize = val;
      this.query();
    },
    // 点击分页页数
    handleCurrentChange(val) {
      this.currentPage = val;
      this.query();
    },
    // 查询
    query() {
      let params = {
        labourName: this.searchObj.labourName,
        pageNumber: this.currentPage,
        pageSize: this.pagesize,
        peopleNumberStatus: this.searchObj.peopleNumberStatus,
      };
      this.showLoading();
      this.$axios({
        method: "post",
        url: `/labour/queryLaborManager`,
        headers: {
          Authorization: this.requestToken,
        },
        data: params,
        params: params,
      })
        .then((res) => {
          this.hideLoading();
          console.log("res---->:", res);
          if (res.data.code == "20000") {
            this.tableData = res.data.data.list;
            this.pagesize = res.data.data.pageSize;
            this.total = res.data.data.total;
          } else {
            this.$message({
              message: res.data.message,
              type: "error",
            });
          }
        })
        .catch((err) => {
          this.hideLoading();
          this.$message({
            message: err,
            type: "error",
          });
        });
    },
    //  重置
    reset() {
      this.searchObj = {
        labourName: "",
      };
      this.query();
    },
    startClick(row) {
      let self = this;
      this.$confirm("请确认是否启用该劳务公司?", "启用", {
        confirmButtonText: "是",
        cancelButtonText: "否",
      })
        .then(() => {
          self.showLoading();
          let params = {
            id: row.id,
            status: "1",
          };
          self
            .$axios({
              method: "get",
              url: `/labour/editLaborStatus`,
              headers: {
                Authorization: self.requestToken,
              },
              params: params,
            })
            .then((res) => {
              self.hideLoading();
              if (res.data.code == "20000") {
                self.$message.success("启用成功！");
                self.query();
              } else {
                self.$message.error(res.data.message);
              }
            })
            .catch((err) => {
              self.hideLoading();
              self.$message.error(err);
            });
        })
        .catch(() => {
          self.$message({
            type: "info",
            message: "已取消启用",
          });
        });
    },
    // 删除
    deleteClick1(row) {
      this.$confirm("请确认是否删除该劳务公司?", "删除", {
        confirmButtonText: "是",
        cancelButtonText: "否",
      })
        .then(() => {
          let params = {
            id: row.id,
          };
          this.showLoading();
          this.$axios({
            method: "get",
            url: `/labour/deleteLaborManager`,
            headers: {
              Authorization: this.requestToken,
            },
            params: params,
          })
            .then((res) => {
              this.hideLoading();
              if (res.data.code == "20000") {
                this.$message.success("删除成功！");
                this.query();
              } else {
                this.$message.error(res.data.message);
              }
            })
            .catch((err) => {
              this.hideLoading();
              this.$message.error(err);
            });
        })
        .catch(() => {});
    },
    // 禁用
    forbidClick(row) {
      let self = this;
      this.$confirm("请确认是否停用该劳务公司?", "停用", {
        confirmButtonText: "是",
        cancelButtonText: "否",
      })
        .then(() => {
          let params = {
            id: row.id,
            status: "0",
          };
          self.showLoading();
          self
            .$axios({
              method: "get",
              url: `/labour/editLaborStatus`,
              headers: {
                Authorization: self.requestToken,
              },
              params: params,
            })
            .then((res) => {
              self.hideLoading();
              if (res.data.code == "20000") {
                self.$message.success("禁用成功！");
                self.query();
              } else {
                self.$message.error(res.data.message);
              }
            })
            .catch((err) => {
              self.hideLoading();
              self.$message.error(err);
            });
        })
        .catch(() => {
          self.$message({
            type: "info",
            message: "已取消停用",
          });
        });
    },
    // 新增
    addCompany() {
      this.newaddFlag = true;
      this.isEditTitle = "新增劳务公司";
    },
    // 详情
    detailsClick(row) {
      let self = this;
      let params = {
        id: row.id,
      };
      self.showLoading();
      self
        .$axios({
          method: "get",
          url: `/labour/queryLabourById`,
          headers: {
            Authorization: self.requestToken,
          },
          params: params,
        })
        .then((res) => {
          self.hideLoading();
          if (res.data.code == "20000") {
            self.detailsFlag = true;
            self.detailsObj = res.data.data;
          } else {
            self.$message.error(res.data.message);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
    // 详情关闭
    detailsClose() {
      this.detailsFlag = false;
    },
    // 修改
    editClick(row) {
      let self = this;
      self.currentId = row.id;
      self.isEditTitle = "修改劳务公司";
      let params = {
        id: row.id,
      };
      self.showLoading();
      self
        .$axios({
          method: "get",
          url: `/labour/queryLabourById`,
          headers: {
            Authorization: self.requestToken,
          },
          params: params,
        })
        .then((res) => {
          self.hideLoading();
          if (res.data.code == "20000") {
            self.newaddFlag = true;
            self.inputObj = res.data.data;
          } else {
            self.$message.error(res.data.message);
          }
        })
        .catch((err) => {
          self.hideLoading();
          self.$message.error(err);
        });
    },
  },
};
</script>
<style scoped>
/* .el-switch__core:after {
    content: "";
    position: absolute;
    top: 1px;
    left: 1px;
    border-radius: 100%;
    transition: all .3s;
    width: 16px;
    height: 16px;
    background-color: #fff;
  }
  .el-switch.is-checked .el-switch__core:after {
    left: 100%;
    margin-left: -17px;
  } */
.common-title-flex {
  display: flex;
}
.common-title-div {
  width: 3px;
  height: 16px;
  background-color: #368af7;
  margin-top: 2px;
}
.common-title-text {
  margin-left: 4px;
  font-size: 14px;
}
.common-list-class {
  display: flex;
  justify-content: space-between;
  margin-top: -10px;
}
.upload-file >>> .el-upload--text {
  border: none;
  width: 100px;
  height: 36px;
}
.setTime_class >>> .el-input__inner {
  width: 88%;
}
</style>>